<?php

namespace App\Http\Controllers\Merchant;

use App\Http\Response;
use App\Withdrawal;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class WithdrawalController extends Controller
{
    use Response;
    public function index(Request $request)
    {
        $mch_id=auth('merchant')->id();
        $paginate=Withdrawal::where([['mch_id','=',$mch_id]])->paginate($request->get('pageSize'),'*','pageNo');
        return $this->success(200,$paginate);
    }

    public function update($id,Request $request)
    {
        $update=Withdrawal::where('id',$id)->update($request->all());
        if ($update){
            return $this->message(200,trans('topic.update success'));
        }else{
            return $this->error(505,trans('topic.update_err'));
        }
    }
}
